package edu.scnu.fans.fingertip.item.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import edu.scnu.fans.fingertip.item.output.ItemSpecOutput;
import lombok.Data;

import java.math.BigDecimal;
import java.time.Instant;

/**
 * 商品规格表（sku）
 */
@Data
@TableName("item_spec")
public class ItemSpec {

    @TableId(type = IdType.AUTO)
    private Long id;

    private Instant created;
    private Instant updated;
    private boolean deleted;

    /** 商品id */
    private Long itemId;
    /** 规格名 */
    private String name;
    /** 原价 */
    private BigDecimal originalPrice;
    /** 现价 */
    private BigDecimal currentPrice;
    
    public ItemSpecOutput transferToOutput() {
        return new ItemSpecOutput(id, itemId, name, originalPrice, currentPrice);
    }

}
